package cn.licoy.wdog.core.controller.hospital2.ry;
/**
 * @Author Sunne
 * @Date 2018/8/23/02311:51
 * @Param emp-hospital
 * 高山仰止,景行行止.虽不能至,心向往之。
 **/

import javax.xml.crypto.Data;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Date;
import java.util.Random;

/**
 *——————————————————————————女神保佑，永无bug——————————————————————
 *
 *                    .::::.
 *                  .::::::::.
 *                 :::::::::::  FUCK YOU
 *             ..:::::::::::'
 *           '::::::::::::'
 *             .::::::::::
 *        '::::::::::::::..
 *             ..::::::::::::.
 *           ``::::::::::::::::
 *            ::::``:::::::::'        .:::.
 *           ::::'   ':::::'       .::::::::.
 *         .::::'      ::::     .:::::::'::::.
 *        .:::'       :::::  .:::::::::' ':::::.
 *       .::'        :::::.:::::::::'      ':::::.
 *      .::'         ::::::::::::::'         ``::::.
 *  ...:::           ::::::::::::'              ``::.
 * ```` ':.          ':::::::::'                  ::::..
 *                    '.:::::'                    ':'````..
 */


public class RYRresponseUtil {
    /**
     * 签名
     * @return
     */
    public static String getToken(){
        return null;
    }

    /**
     * 生产签名
     * @return
     */
    public static String getSingn(){
        String AppKey = "y745wfm8yjpfv";
        String AppSecret = "ItriMHhnWZ";
        Date date = new Date();
        String dates =Long.toString(date.getTime());
        int Nonce =(int)(Math.random()*10000000);
        String Signature = AppSecret+Nonce+dates;
        try {
            MessageDigest md = MessageDigest.getInstance("SHA1");
            md.update(Signature.getBytes());
            StringBuffer buf = new StringBuffer();
            byte[] bits = md.digest();
            for(int i=0;i<bits.length;i++){
                int a = bits[i];
                if(a<0) a+=256;
                if(a<16) buf.append("0");
                buf.append(Integer.toHexString(a));
            }
            return buf.toString();
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
            return null;
        }
    }
}
